package com.asura.ops.sync.sdk.consumer;

import com.asura.ops.sync.sdk.handle.SyncHandler;
import com.asura.ops.sync.sdk.model.MqPayload;
import lombok.extern.slf4j.Slf4j;

import javax.annotation.Resource;

/**
 * @author: huyuntao(Mars)
 * @date: 2022/8/10
 * @description: 类的描述
 */
@Slf4j
public class DefaultChangeConsumer implements ChangeConsumer {

    @Resource
    private SyncHandler syncHandler;

    @Override
    public Result handle(MqPayload payload) {
        try {
            syncHandler.handle(payload);
        } catch (Exception e) {
            log.info("Ops-sdk异常:{}", e);
            return Result.fail(e.getMessage());
        }
        return Result.success();
    }
}
